home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / User Contributions / zebu v3.3.3 (LALR parser) / COMPILE-ZEBU.lisp < prev    next >
Encoding:
Text File  |  1994-09-12  |  5.9 KB  |  177 lines  |  [TEXT/ttxt]

  1. ; -*- mode:     CL -*- ----------------------------------------------------- ;
  2. ; File:         COMPILE-ZEBU.l
  3. ; Description:  compiling Zebu without DEFSYS
  4. ; Author:       Joachim H. Laubsch
  5. ; Created:      13-May-92
  6. ; Modified:     Tue Aug  2 17:53:37 1994 (Joachim H. Laubsch)
  7. ; Language:     CL
  8. ; Package:      CL-USER
  9. ; Status:       Experimental (Do Not Distribute) 
  10. ; RCS $Header: $
  11. ;
  12. ; (c) Copyright 1992, Hewlett-Packard Company
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14. ; Revisions:
  15. ; RCS $Log: $
  16. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  17. #+MCL
  18. (unless (find-package "CL-USER")
  19.   (defpackage "USER" (:nicknames "COMMON-LISP-USER" "CL-USER")))
  20.  
  21. (in-package "CL-USER")
  22.  
  23. (proclaim '(special *ZEBU-directory* *ZEBU-binary-directory*))
  24.  
  25. ;; edit the following form for your Lisp, and the directory where you keep Zebu
  26. (setq *ZEBU-directory*
  27.       (make-pathname :directory
  28.              (pathname-directory
  29.               #-ALLEGRO *load-pathname*
  30.               #+ALLEGRO (merge-pathnames *load-pathname*
  31.                          *default-pathname-defaults*)))
  32.  
  33.       *ZEBU-binary-directory*
  34.       (make-pathname :directory (append (pathname-directory *ZEBU-directory*)
  35.                     (list "binary"))))
  36.  
  37. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  38. ;; compilation: Production mode
  39. (proclaim '(optimize (speed 3) (safety 0) (compilation-speed 0)))
  40.  
  41. ;; compilation: Test mode
  42. ;;(proclaim '(optimize (speed 0) (safety 3)))
  43. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  44. #+LUCID(or (probe-file *ZEBU-binary-directory*)
  45.        (shell (format nil "mkdir ~a" (namestring *ZEBU-binary-directory*))))
  46.  
  47. #+ALLEGRO(unless (probe-file *ZEBU-binary-directory*)
  48.        (let ((dir (format nil "~abinary"
  49.                   (namestring *ZEBU-directory*))))
  50.          (unless (zerop (run-shell-command
  51.                  (format nil "mkdir ~a" dir)))
  52.            (error "Could not create directory ~s" dir))))
  53.  
  54. #+MCL(create-file *ZEBU-binary-directory* :if-exists nil)
  55.  
  56. #+(or MCL Allegro)
  57. (declaim (special *load-source-pathname-types* *load-binary-pathname-types*))
  58.  
  59. #+(or MCL Allegro)
  60. (setq *load-source-pathname-types* '("lisp" NIL))
  61.  
  62. #+(or MCL Allegro)
  63. (setq *load-binary-pathname-types* '("fasl"))
  64. #+(and :SUN :LUCID)
  65. (defvar *load-binary-pathname-types* '("sbin"))
  66.  
  67. (let ((*default-pathname-defaults*
  68.        (merge-pathnames
  69.     *ZEBU-directory*
  70.     (make-pathname :type (first *load-source-pathname-types*)))))
  71.   (load (merge-pathnames "zebu-package")))
  72.  
  73. (let ((source-path (merge-pathnames
  74.             *ZEBU-directory*
  75.             (make-pathname
  76.              :type (first *load-source-pathname-types*))))
  77.       (binary-path (merge-pathnames
  78.             (make-pathname
  79.              :type (first *load-binary-pathname-types*))
  80.             *ZEBU-binary-directory*))
  81.       (*compile-verbose* t)
  82.       (*load-verbose* t)
  83.       (load-before-compile '()))
  84.   (flet ((do-post-poned-load ()
  85.        (dolist (file-path (nreverse load-before-compile))
  86.          (load (merge-pathnames file-path binary-path)))
  87.        (setq load-before-compile nil)))
  88.     (dolist (task '((compile "zebu-package")
  89.             (compile "zebu-aux")
  90.             (load    "zebu-aux")
  91.             (compile "zebu-kb-domain")
  92.             (load    "zebu-kb-domain")
  93.             (compile "zebu-mg-hierarchy")
  94.             (load    "zebu-mg-hierarchy")
  95.             (compile "zebu-regex")
  96.             (load    "zebu-regex")
  97.             (compile "zebu-loader")
  98.             (load    "zebu-loader")
  99.             (compile "zebu-driver")
  100.             (compile "zebu-actions")
  101.             (compile "zebu-oset")
  102.             (load    "zebu-oset")
  103.             (compile "zebu-g-symbol")
  104.             (load    "zebu-g-symbol")
  105.             (compile "zebu-loadgram")
  106.             (load    "zebu-loadgram")
  107.             (compile "zebu-generator")
  108.             (load    "zebu-generator")
  109.             (compile "zebu-lr0-sets")
  110.             (load    "zebu-lr0-sets")
  111.             (compile "zebu-empty-st")
  112.             (load    "zebu-empty-st")
  113.             (compile "zebu-first")
  114.             (load    "zebu-first")
  115.             (compile "zebu-follow")
  116.             (load    "zebu-follow")
  117.             (compile "zebu-tables")
  118.             (compile "zebu-slr")
  119.             (load    "zebu-slr")
  120.             (compile "zebu-closure")
  121.             (load    "zebu-closure")
  122.             (compile "zebu-lalr1")
  123.             (load    "zebu-lalr1")
  124.             (compile "zebu-dump")
  125.             (load    "zebu-dump")
  126.             (compile "zebu-compile")
  127.             (load    "zebu-compile")
  128.             (load    "zebu-tables")
  129.             (compile "zebu-printers")
  130.             (load    "zebu-printers") ; only for debugging
  131.             (zebu    "zebu-mg")
  132.             (compile "zebu-mg-domain")
  133.             (compile "zebu-kb-domain")
  134.             (load    "zebu-kb-domain")
  135.             (compile "zebu-tree-attributes")
  136.             (load    "zebu-tree-attributes")
  137.             (compile "zebra-debug")))
  138.       (let ((file-path (make-pathname :name (cadr task))))
  139.     ;; (print task)
  140.     (case (car task)
  141.       (compile (let* ((ofile (merge-pathnames file-path binary-path))
  142.               (odate (and (probe-file ofile)
  143.                       (file-write-date ofile)))
  144.               (ifile (merge-pathnames file-path source-path))
  145.               (idate (if (probe-file ifile)
  146.                      (file-write-date ifile)
  147.                    (error "File not found ~a" ifile))))
  148.              (when (or (null odate) (> idate odate))
  149.                ;; now do the postponed loads
  150.                (do-post-poned-load)
  151.                (compile-file ifile :output-file ofile))))
  152.       (load                ; postpone load
  153.        (push file-path load-before-compile))
  154.       (zebu    (let* ((ofile (merge-pathnames
  155.                   (merge-pathnames
  156.                    (make-pathname :type "tab")
  157.                    file-path)
  158.                   binary-path))
  159.               (odate (and (probe-file ofile)
  160.                       (file-write-date ofile)))
  161.               (ifile (merge-pathnames
  162.                   (merge-pathnames
  163.                    (make-pathname :type "zb")
  164.                    file-path)
  165.                   source-path))
  166.               (idate (if (probe-file ifile)
  167.                      (file-write-date ifile)
  168.                    (error "File not found ~a" ifile)))
  169.               zb:*generate-domain*)
  170.              (when (or (null odate) (> idate odate))
  171.                (do-post-poned-load)
  172.                (ZB:zebu-compile-file ifile :output-file ofile)))))))))
  173.  
  174. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  175. ;;                            End of COMPILE-ZEBU.l
  176. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  177.